package com.shujia.flink.tf

import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}

object Demo8Union {
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment


    val ds1: DataStream[String] = env.socketTextStream("master", 7777)
    val ds2: DataStream[String] = env.socketTextStream("master", 8888)

    /**
      * 将多个流合并成一个流，类型要一致
      *
      */

    val unionDS: DataStream[String] = ds1.union(ds2)

    unionDS.print()

    env.execute()

  }

}
